<script language='javascript'>

	function getID(id){
		return document.getElementById(id);
	}
	
	var xmlhttp=null;
	function GetXmlHttpObject(){
		if (window.ActiveXObject) 
			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		else if (window.XMLHttpRequest)	
			xmlhttp = new XMLHttpRequest();
		return null;
	}
	GetXmlHttpObject();
	
	
	function getCust(){
		
		if (xmlhttp==null)		{
			alert ("Your browser does not support AJAX!");
			return;
		}
		
		var url="Employee.xml";
		xmlhttp.onreadystatechange = printEmp;
		xmlhttp.open("GET", url, true);
		xmlhttp.send(null);
	}


	function printEmp()	{
		if (xmlhttp.readyState==4)	{
			var xml = xmlhttp.responseText;
			
			var xmlObj = loadXML(xml);
			//alert(xmlObj.tagName );
			alert(xmlObj.childNodes[2].tagName);
			alert(xmlObj.childNodes[2].getAttribute("sex") );	
			alert(xmlObj.childNodes[2].text );	
			alert(xmlObj.childNodes[3].childNodes[2].getAttribute("id") );	
			alert(xmlObj.getElementsByTagName('employee').length );
		}
	}
	function loadXML(xml){
		
		var xmlObj = null;
		if (window.DOMParser) {
			var parser = new DOMParser();
			xmlObj = parser.parseFromString(xml, "text/xml");
		} 
		else { // Internet Explorer
			xmlObj = new ActiveXObject("Microsoft.XMLDOM");
			xmlObj.async = "false";
			xmlObj.loadXML(xml);
		}
		return xmlObj.childNodes[1];
	}



 


</script>

<input type='button' onClick='getCust();'>

<b><span id="companyname"></span></b><br />
<span id="contactname"></span><br />
<span id="address"></span>
<span id="city"></span><br/>
<span id="country"></span>
